package api

import (
	"gitee.com/linxing_3/sr-core/domain/api"
	"gitee.com/mkwchecking/sr-admin/apps/admin/acl"
	"github.com/gin-gonic/gin"
)

// GetAsDict 获取 SysConfig 字典
// @Summary 获取 SysConfig 字典
// @Tags SysConfig
// @Produce json
// @Param Authorization header string true "Authorization"
// @Success 200 {object} api.Response
// @Router /admin/sys_config/dict [get]
func (a *SysConfig) GetAsDict(c *gin.Context) {
	req := &acl.SysConfigListReq{}

	apiCtx := api.NewCtx(c).WithReq(req)
	if !apiCtx.Do() {
		return
	}

	if data, err := a.srv.GetAsDict(apiCtx.Context(), req); err != nil {
		apiCtx.WriteErr(nil, err, "获取失败")
	} else {
		apiCtx.WriteOK(data, "获取成功")
	}
}
